package com.zhangyanqiang.traceId.filter;

import org.slf4j.MDC;

/**
 * @author zhangyanqiang
 * @date 2020/7/30
 **/
public class TraceIdUtil {

    public static final String logTraceId ="logTraceId";

    public static String getLogTraceId(){
        return MDC.get(logTraceId);
    }
    public static void removeLogTraceId(){
        MDC.remove(logTraceId);
    }
    public static void addTraceId(){
        String traceId = ShortUUIDGenerator.generateShortUuid();
        MDC.put(logTraceId,traceId);
    }

    public static void main(String[] args) {
        System.out.println(ShortUUIDGenerator.generateShortUuid());
    }

}
